package com.lyc.day1101.demo4;

/**
 * @author ：Xiaochen
 * @date ：Created in 2022/11/1 18:53
 * @description：
 * @modified By：
 * @version:
 */
public class TestYield {
    public static void main(String[] args) {
        YieldDemo yieldDemo = new YieldDemo();
        YieldDemo yieldDemo1 = new YieldDemo();
        yieldDemo.start();
        yieldDemo1.start();
    }
}
class YieldDemo extends Thread{
    @Override
    public void run() {
        for (int i = 0; i < 20; i++) {
            Thread.yield();
            System.out.println(Thread.currentThread().getName()+"***********"+i);
        }
    }
}